﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpExperiments.Collections
{
	public static class CollectionsAsFuncs
	{
		public static Func<K, V> AsFunc<K, V>(this IDictionary<K, V> dict)
		{
			return k => dict[k];
		}

		public static Func<int, T> AsFunc<T>(this IList<T> list)
		{
			return i => list[i];
		}

		public static Func<T, bool> AsFunc<T>(this ISet<T> set)
		{
			return t => set.Contains(t);
		}
	}
}
